Xbasic
Array clear Method
Syntax
V <array>.clear([N start[,N end]])
Arguments
- startNumeric
The index of the first element to clear.
- endNumeric
The index of the last element to clear.
Description
Clear the array.
Discussion
The <array>.clear() method clears the contents of a single dimensional array. The optional start and end arguments restrict the portion of the array that is cleared out.
Example
Assume an array "A" contains the following elements:
dim A[8] as C A[1] = "Orange" A[2] = "Banana" A[3] = "Apple" A[4] = "Pineapple" A[5] = "Mango" ? A = [1] = "Orange" [2] = "Banana" [3] = "Apple" [4] = "Pineapple" [5] = "Mango" [6] = "" [7] = "" [8] = ""
After A.clear(3,4), the array will look like this:
A.clear(3,4) ? A = [1] = "Orange" [2] = "Banana" [3] = "" [4] = "" [5] = "Mango" [6] = "" [7] = "" [8] = ""
To remove blank entries from an array, use the <array>.delete() method or the <array>.initialize() method. For example:
temp = A.dump("R") A.clear(1, A.size()) A.initialize(temp) ? A = [1] = "Orange" [2] = "Banana" [3] = "Mango" [4] = "" [5] = "" [6] = "" [7] = "" [8] = ""
See Also